home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / swapmon3.zip / Install.cmd next >
OS/2 REXX Batch file  |  1997-06-01  |  1KB  |  48 lines

  1. /* Load REXXUTIL functions */
  2. call rxfuncadd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
  3. call sysloadfuncs
  4.  
  5. /* Find boot drive */
  6. BootDrive=left(value('SYSTEM_INI',,'OS2ENVIRONMENT'),2)
  7.  
  8. dest=directory() || "\SwapMon.exe"
  9. if \SysCreateObject("WPProgram", "SwapMon", "<WP_DESKTOP>", "EXENAME=" dest, "UPDATE"),
  10.     then say "Failed to create object"
  11.  
  12. InFile=BootDrive || "\CONFIG.SYS"
  13. OutFile=BootDrive || "\CONFIG.SWB"
  14.  
  15. /* Delete any previous backup file called CONFIG.SWB */
  16. If Stream(OutFile, 'C', 'Query Exists') <> '' Then Do
  17.     Call SysFileDelete(OutFile)
  18. End
  19.  
  20. /* We now backup CONFIG.SYS and check if there's already an
  21.    entry for SWAPMON.SYS
  22.    */
  23.  
  24. AlreadyThere = 0
  25.  
  26. Do While Lines(InFile) > 0
  27.     Data = LineIn(InFile)
  28.     /* Store the infile data because... */
  29.     OrigData = Data
  30.     /* ...we want to write in the same case */
  31.     Data = Translate(Data)
  32.     /* If this line is REMmed then skip it */
  33.     Place = Pos("REM ", Data)
  34.     If Place = 0 Then Do
  35.         Place = Pos("SWAPMON.SYS", Data)
  36.         If Place \= 0 Then Do
  37.             AlreadyThere = 1
  38.         End
  39.     End
  40.     Call LineOut OutFile, OrigData
  41. End
  42.  
  43. If AlreadyThere = 0 Then Do
  44.     DeviceLine = "DEVICE=" || directory() || "\SWAPMON.SYS"
  45.     OutFile=BootDrive || "\CONFIG.SYS"
  46.     Call LineOut OutFile, DeviceLine
  47. End
  48.